<?php


namespace app\plugins\MemberPointCashSettlement;

class System extends \app\system\controller\AdminBase
{
	public function __construct()
	{
		parent::__construct();
		$Common = new Common();
		$Common->check_plug_auth();
	}
	public function get_settlement_list()
	{
		$options = $this->request->get();
		$options["limit"] = $this->page_size;
		$options["page"] = $this->page_no;
		$result = \app\system\service\MemberAppService::get_settlement_list($options);
		$this->response($result["code"], "获取成功", $result["data"], ["count", $result["count"]], ["pages", $result["pages"]]);
	}
	public function get_settlement_info($id)
	{
		$options = ["id" => $id];
		$result = \app\system\service\MemberAppService::get_settlement_info($options);
		if ($result["code"] == 1) {
			$this->response($result["code"], "获取成功", $result["data"]);
		} else {
			$this->response($result["code"], $result["msg"]);
		}
	}
	public function processing_settlement()
	{
		$options = $this->request->post();
		$validate = \think\Validate::make(["id" => "require", "status" => "require"], ["id.require" => "id不能为空！", "status.require" => "状态码不能为空！"]);
		if (!$validate->check($options)) {
			$this->response(\app\system\model\Code::fail, $validate->getError());
		}
		$options["admin_id"] = $this->admin_info["id"];
		$options["admin_name"] = $this->admin_info["name"];
		$result = \app\system\service\MemberAppService::processing_settlement($options);
		if ($result["code"] == 1) {
			$this->response($result["code"], $result["msg"]);
		} else {
			$this->response($result["code"], $result["msg"]);
		}
	}
}